package com.johnny.xia.util;

import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName : ArrayListTest
 * @Description : test
 * @Author : Xia Long
 * @MailTo : johnny.xia@qq.com
 * @Date: 2024/05/08 15:30
 */
public class ArrayListTest {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add("a");
        list.add("a");
        list.add("c");
        list.add("d");
        list.add("a");

        for(String a : list){
            if(a.equals("a")){
                list.remove(a);
            }
        }
        list.forEach(s -> {
            if(s.equals("a")){
                list.remove(s);
            }
        });

        System.out.println(list.size());
//
//        User u = new User();
//        u.setUserId(1234L);
//
//        RichemontResponse<User> ric = new RichemontResponse<>(200, "success", u);
//        System.out.printf(JSON.toJSONString(ric));
    }
}
